ostree.git
6 years agolib/repo-pull: add signature check while fetching summary
Denis Pynkin [Wed, 27 Nov 2019 13:26:54 +0000 (16:26 +0300)]
lib/repo-pull: add signature check while fetching summary

Check the signature of downloaded summary file.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/repo-pull: set default for sign-verify-summary
Denis Pynkin [Wed, 27 Nov 2019 13:24:01 +0000 (13:24 +0000)]
lib/repo-pull: set default for sign-verify-summary

Use FALSE as default for summary verification while pulling from remote.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/repo-pull: change sign supporting functions
Denis Pynkin [Wed, 27 Nov 2019 13:15:26 +0000 (13:15 +0000)]
lib/repo-pull: change sign supporting functions

Change the API of supporting functions `_load_public_keys()` and
`_ostree_repo_sign_verify()` -- pass repo object and remote name
instead of OtPullData object. This allows to use these functions
not only in pull-related places.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agogpg: do not fail GPG-related configuration get for remote
Denis Pynkin [Wed, 27 Nov 2019 09:21:39 +0000 (12:21 +0300)]
gpg: do not fail GPG-related configuration get for remote

We don't need anymore stubs for verification options for remotes
in case if ostree built without GPG support.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agoman: add signature options for ostree summary
Denis Pynkin [Tue, 26 Nov 2019 10:35:30 +0000 (13:35 +0300)]
man: add signature options for ostree summary

Add a description of new options `--sign-type` and `--sign` for
`ostree summary` command.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agotests/sign: new test for summary file verification
Denis Pynkin [Tue, 26 Nov 2019 10:01:36 +0000 (13:01 +0300)]
tests/sign: new test for summary file verification

Add test for signature verification of summary file during the pull.
Adopted version of GPG tests from `test-pull-summary-sigs.sh`.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/repo-pull: verify signature on summary pull
Denis Pynkin [Tue, 26 Nov 2019 09:57:35 +0000 (09:57 +0000)]
lib/repo-pull: verify signature on summary pull

Add signature verification on summary file pulling.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agobin/summary: add signing with alternative mechanism
Denis Pynkin [Tue, 26 Nov 2019 09:48:35 +0000 (12:48 +0300)]
bin/summary: add signing with alternative mechanism

Allow to sign the summary file with alternative signing mechanism.
Added new options:
- --sign-type -- select the engine (defaults to ed25519)
- --sign -- secret key to use for signing

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: new function for summary file signing
Denis Pynkin [Tue, 26 Nov 2019 09:44:44 +0000 (12:44 +0300)]
lib/sign: new function for summary file signing

Add function `ostree_sign_summary()` allowing to sign the summary file.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agotests/sign: allow to start pull test without libsodium
Denis Pynkin [Tue, 26 Nov 2019 09:40:57 +0000 (09:40 +0000)]
tests/sign: allow to start pull test without libsodium

Allow to run the pulling test if there is no ed25519 support.
Test the signed pull only with dummy engine. Fixed tests names.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: fix the false failure while loading keys
Denis Pynkin [Mon, 25 Nov 2019 19:53:28 +0000 (22:53 +0300)]
lib/sign: fix the false failure while loading keys

Usage of 'g_warning()' inside keys loading funcrion lead to false
failure: the key loading attempt for the wrong engine breaks the
pulling process instead of trying to use this key with correct engine.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agotests/sign: add verification key for pulling with dummy
Denis Pynkin [Mon, 25 Nov 2019 19:50:07 +0000 (19:50 +0000)]
tests/sign: add verification key for pulling with dummy

After splitting out the common key to secret/public inside the dummy engine we
need to pass the the public key for remote with dummy engine usage.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: use separate public and secret keys for 'dummy'
Denis Pynkin [Mon, 25 Nov 2019 19:20:03 +0000 (22:20 +0300)]
lib/sign: use separate public and secret keys for 'dummy'

The initial implementation with single key for secret and public parts
doesn't allow to test pulling with several signing engines used.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: allow to build with glib version less than 2.44
Denis Pynkin [Mon, 18 Nov 2019 23:44:16 +0000 (02:44 +0300)]
lib/sign: allow to build with glib version less than 2.44

Ubuntu 14.04 uses glib-2.40 which have no some shiny macroses
for interface declaration.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agotests/sign: disable GPG for alternatively signed pull
Denis Pynkin [Mon, 18 Nov 2019 11:28:40 +0000 (14:28 +0300)]
tests/sign: disable GPG for alternatively signed pull

Explicitly disable GPG verification for remote while testing
alternative signing mechanism.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agotests: use option "--no-sign-verify" for adding remote
Denis Pynkin [Sun, 17 Nov 2019 18:01:13 +0000 (21:01 +0300)]
tests: use option "--no-sign-verify" for adding remote

Option "--no-sign-verify" disable the signature verification including
GPG. So use it in tests instead of "--no-gpg-verification".

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agobin/remote-add: added "--no-sign-verify" option
Denis Pynkin [Sun, 17 Nov 2019 17:58:33 +0000 (20:58 +0300)]
bin/remote-add: added "--no-sign-verify" option

Option "--no-sign-verify" disable the signature verification while
adding remote.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agotests/local-pull: test "--sign-verify" option
Denis Pynkin [Sun, 17 Nov 2019 17:17:27 +0000 (20:17 +0300)]
tests/local-pull: test "--sign-verify" option

Ensure what with this option only signed commit is pulled.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agotests/sign: use library functions for ed25519 keys
Denis Pynkin [Sun, 17 Nov 2019 17:15:46 +0000 (20:15 +0300)]
tests/sign: use library functions for ed25519 keys

Switch to library functions usage.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agotests/libtest: add functions for ed25519 tests
Denis Pynkin [Sun, 17 Nov 2019 17:02:13 +0000 (20:02 +0300)]
tests/libtest: add functions for ed25519 tests

Add functions for keys generation to be used in signing-related tests:
- gen_ed25519_keys initializing variables ED25519PUBLIC, ED25519SEED and
  ED25519SECRET with appropriate base64-encoded keys
- gen_ed25519_random_public print a random base64 public key (used in
  tests with wrong keys)

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agobin/pull-local: add --sign-verify
Denis Pynkin [Sun, 17 Nov 2019 16:58:29 +0000 (19:58 +0300)]
bin/pull-local: add --sign-verify

Add option for enabling verification while pulling from local.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agoman: document commit signing
Denis Pynkin [Sun, 10 Nov 2019 16:17:58 +0000 (19:17 +0300)]
man: document commit signing

Added options descriptions for `ostree-commit` allowing
to sign the commit.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agoapidoc: add API documentation for signing interface
Denis Pynkin [Sun, 10 Nov 2019 13:51:23 +0000 (16:51 +0300)]
apidoc: add API documentation for signing interface

Add the documentation for all public functions.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agobash-completion: add completion for `ostree sign`
Denis Pynkin [Fri, 1 Nov 2019 00:00:13 +0000 (03:00 +0300)]
bash-completion: add completion for `ostree sign`

Add bash completion with supported options for signing command.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agoman: document `ostree sign`
Denis Pynkin [Thu, 31 Oct 2019 23:44:25 +0000 (02:44 +0300)]
man: document `ostree sign`

Add man page for `ostree sign`.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agotests/sign: check system-wide config and revoked keys
Denis Pynkin [Tue, 29 Oct 2019 19:23:55 +0000 (22:23 +0300)]
tests/sign: check system-wide config and revoked keys

Extend the ed25519 tests with checking the system-wide directory
keys loading code(with the help of redefinition).
Added test of ed25519 revoking keys mechanism.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agobuiltin/sign: add option 'keys-dir'
Denis Pynkin [Tue, 29 Oct 2019 19:16:09 +0000 (22:16 +0300)]
builtin/sign: add option 'keys-dir'

Option '--keys-dir' is used for redefinition of default directories with
public/revoked keys. If keys directory is set then default directories
are ignored and target directory is expected to contain following
structure for ed25519 signature mechanism:

dir/
  trusted.ed25519      <- file with trusted keys
  revoked.ed25519      <- file with revoked keys
  trusted.ed25519.d/   <- directory with files containing trusted keys
  revoked.ed25519.d/   <- directory with files containing revoked keys

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: add revoking mechanism for ed25519 keys
Denis Pynkin [Sun, 27 Oct 2019 20:15:10 +0000 (23:15 +0300)]
lib/sign: add revoking mechanism for ed25519 keys

Skip public keys verification if key is marked as invalid key.
Allow to redefine system-wide directories for ed25519 verification.
Minor bugfixes.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: add ostree_seign_clear_keys function
Denis Pynkin [Sun, 27 Oct 2019 19:45:48 +0000 (19:45 +0000)]
lib/sign: add ostree_seign_clear_keys function

Add the function for implicit cleanup of all loaded keys.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: minor optimisation for ed25519
Denis Pynkin [Sun, 27 Oct 2019 18:21:21 +0000 (21:21 +0300)]
lib/sign: minor optimisation for ed25519

Exclude unneeded conversion while load keys from files.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agosign: use common function for loading public keys during pulling
Denis Pynkin [Mon, 7 Oct 2019 22:55:25 +0000 (01:55 +0300)]
sign: use common function for loading public keys during pulling

Add function `_load_public_keys()` to pre-load public keys according
remote's configuration. If no keys configured for remote, then use
system-wide configuration.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: allow to add keys as base64 string for ed25519
Denis Pynkin [Mon, 7 Oct 2019 20:37:08 +0000 (23:37 +0300)]
lib/sign: allow to add keys as base64 string for ed25519

Allow to add public and secret key for ed25519 module as based64 string.
This allows to use common API for pulling and builtins without knowledge
of used signature algorithm.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: public API optimisation
Denis Pynkin [Sun, 6 Oct 2019 23:59:15 +0000 (02:59 +0300)]
lib/sign: public API optimisation

Removed from public `ostree_sign_detached_metadata_append` function.
Renamed `metadata_verify` into `data_verify` to fit to real
functionality.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign-ed25519: cleanup unneeded code
Denis Pynkin [Sun, 6 Oct 2019 20:40:04 +0000 (23:40 +0300)]
lib/sign-ed25519: cleanup unneeded code

Removed unused code.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agobuiltin/sign: allow to use multiple public keys for verification
Denis Pynkin [Thu, 5 Sep 2019 13:33:52 +0000 (16:33 +0300)]
builtin/sign: allow to use multiple public keys for verification

`ostree sign` is able to use several public keys provided via arguments
and via file with keys.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agosign: fix memory leaks and code cleanup
Denis Pynkin [Wed, 4 Sep 2019 23:04:25 +0000 (02:04 +0300)]
sign: fix memory leaks and code cleanup

Return `const char *` instead of copy of the string -- this allow to
avoid unneeded copying and memory leaks in some constructions.
Minor code cleanup and optimisations.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agotests/gpg: skip test in JS if GPG is not supported
Denis Pynkin [Thu, 29 Aug 2019 21:54:17 +0000 (00:54 +0300)]
tests/gpg: skip test in JS if GPG is not supported

Skip the single JS test which throws an error if GPG support
is disabled in a build time.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agobuiltin/sign: allow to sign with keys from secret file
Denis Pynkin [Wed, 28 Aug 2019 01:21:22 +0000 (04:21 +0300)]
builtin/sign: allow to sign with keys from secret file

Read keys from secret file provided by `--keys-file=` option.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: read ed25519 public keys from well known places
Denis Pynkin [Wed, 28 Aug 2019 00:16:22 +0000 (03:16 +0300)]
lib/sign: read ed25519 public keys from well known places

If not provided key of file name with keys for remote, then try to use
system defaults:
- /etc/ostree/trusted.ed25519
- /etc/ostree/trusted.ed25519.d/*
- /usr/share/ostree/trusted.ed25519
- /usr/share/ostree/trusted.ed25519.d/*

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: add support of file with valid keys for remote
Denis Pynkin [Mon, 26 Aug 2019 21:51:20 +0000 (00:51 +0300)]
lib/sign: add support of file with valid keys for remote

Allow to use custom file with public keys for remote.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: disable mandatory signature check
Denis Pynkin [Mon, 26 Aug 2019 21:28:44 +0000 (00:28 +0300)]
lib/sign: disable mandatory signature check

Do not check the signature check by default.
Need to enable it explicitly.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agotests/sign: add initial test for pulling
Denis Pynkin [Mon, 26 Aug 2019 19:11:32 +0000 (22:11 +0300)]
tests/sign: add initial test for pulling

Test if we pull signed commits from remote.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agosign: check signatures for pulled commits
Denis Pynkin [Mon, 26 Aug 2019 19:08:10 +0000 (22:08 +0300)]
sign: check signatures for pulled commits

If `verification-key` is set for remote it is used as a public key for
checking the commit pulled from that remote.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agosign: fixes for ed25519 for loading public keys from files
Denis Pynkin [Mon, 26 Aug 2019 18:59:34 +0000 (21:59 +0300)]
sign: fixes for ed25519 for loading public keys from files

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agobuiltin/sign: remove libsodium dependency
Denis Pynkin [Mon, 26 Aug 2019 18:55:53 +0000 (21:55 +0300)]
builtin/sign: remove libsodium dependency

Now do not need to compile/link builtin with external dependencies.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agosign: fix error return for dummy module
Denis Pynkin [Mon, 26 Aug 2019 18:51:03 +0000 (21:51 +0300)]
sign: fix error return for dummy module

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agosign: fix unneeded objects creation
Denis Pynkin [Mon, 26 Aug 2019 18:47:10 +0000 (21:47 +0300)]
sign: fix unneeded objects creation

Do not create objects just for supported modules list.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agobuiltin/sign: remove libsodium-specific code
Denis Pynkin [Mon, 19 Aug 2019 21:56:27 +0000 (00:56 +0300)]
builtin/sign: remove libsodium-specific code

Use only common sign API without libsoduim parts.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agotests/sign: check public keys load from file
Denis Pynkin [Sun, 18 Aug 2019 23:49:50 +0000 (02:49 +0300)]
tests/sign: check public keys load from file

Test ed25519 public keys load from file and verify signed commit
against that file.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agobuiltin/sign: allow to provide the file with public keys
Denis Pynkin [Sun, 18 Aug 2019 23:47:45 +0000 (02:47 +0300)]
builtin/sign: allow to provide the file with public keys

Added option `--keys-file` for `ostree sign`.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agosign: API changes for public keys and CLI keys format
Denis Pynkin [Fri, 9 Aug 2019 19:07:57 +0000 (22:07 +0300)]
sign: API changes for public keys and CLI keys format

API changes:
- added function `ostree_sign_add_pk()` for multiple public keys using.
- `ostree_sign_set_pk()` now substitutes all previously added keys.
- added function `ostree_sign_load_pk()` allowed to load keys from file.
- `ostree_sign_ed25519_load_pk()` able to load the raw keys list from file.
- use base64 encoded public and private ed25519 keys for CLI and keys file.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agotests: add test for commits sign/verification
Denis Pynkin [Thu, 1 Aug 2019 23:20:33 +0000 (02:20 +0300)]
tests: add test for commits sign/verification

Add tests checking:
- sign mechanism is in working state
- module 'dummy' is able to sign/verify commit
- module 'ed25519' is able to sign/verify commit
- both modules could be used for the same commit
- 'ostree sign' builtin works with commits
- 'ostree commit' builtin able to sign commits

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: enable verification for pulling
Denis Pynkin [Thu, 1 Aug 2019 23:16:56 +0000 (02:16 +0300)]
lib/sign: enable verification for pulling

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agosign: allow to sign commits from CLI
Denis Pynkin [Wed, 31 Jul 2019 01:00:19 +0000 (04:00 +0300)]
sign: allow to sign commits from CLI

Add signing ability to commit builtin.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agosign: add new builtin for signing
Denis Pynkin [Tue, 30 Jul 2019 22:13:48 +0000 (01:13 +0300)]
sign: add new builtin for signing

This builtin allows to sign and verify commit with new signature
mechanism. At the moment it is possible to use 'dummy' and 'ed25519'
signing modules.

'dummy' module use any ASCII string from command line as a key for
commit's signing or verification.

Support of ed25519 signature is implemented with `libsoium` library.
Secret and public key should be provided in hex presentation via
command line.

Based on 'gpg-sign' source.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agolib/sign: initial implementation
Denis Pynkin [Sun, 28 Jul 2019 23:32:28 +0000 (02:32 +0300)]
lib/sign: initial implementation

Added the initial version of signing interface allowing to allowing to
sign and verify commits.
Implemented initial signing modules:
 - dummy -- simple module allowing to sign/verify with ASCII string
 - ed25519 -- module allowing to sign/verify commit with ed25519
   (EdDSA) signature scheme provided by libsodium library.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agoAdd libsodium dependency
Denis Pynkin [Sat, 15 Jun 2019 17:10:47 +0000 (20:10 +0300)]
Add libsodium dependency

Allow to configure with libsodium flag.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
6 years agoMerge pull request #2041 from cgwalters/auto-sepolicy
OpenShift Merge Robot [Tue, 24 Mar 2020 19:06:55 +0000 (20:06 +0100)]
Merge pull request #2041 from cgwalters/auto-sepolicy

 repo/commit: Add support for --selinux-policy-from-base

6 years agorepo/commit: Add support for --selinux-policy-from-base
Colin Walters [Sat, 21 Mar 2020 14:48:24 +0000 (14:48 +0000)]
repo/commit: Add support for --selinux-policy-from-base

The [dev-overlay](https://github.com/coreos/coreos-assembler/blob/332c6ab3b91778d904224c3c960d9cc4739d60bd/src/cmd-dev-overlay)
script shipped in coreos-assembler mostly exists to deal
with the nontrivial logic around SELinux policy.  Let's make
the use case of "commit some binaries overlaying a base tree, using
the base's selinux policy" just require a magical
`--selinux-policy-from-base` argument to `ostree commit`.

A new C API was added to implement this in the case of `--tree=ref`;
when the base directory is already checked out, we can just reuse
the existing logic that `--selinux-policy` was using.

Requires: https://github.com/ostreedev/ostree/pull/2039

6 years agoMerge pull request #2042 from cgwalters/pull-repeated-no-flake
OpenShift Merge Robot [Tue, 24 Mar 2020 15:49:14 +0000 (16:49 +0100)]
Merge pull request #2042 from cgwalters/pull-repeated-no-flake

tests/pull-repeated: Bump up retries to match max fails

6 years agotests/pull-repeated: Bump up retries to match max fails
Colin Walters [Tue, 24 Mar 2020 12:24:46 +0000 (12:24 +0000)]
tests/pull-repeated: Bump up retries to match max fails

This test keeps occasionally failing in CI - as expected, because
we retry 8 times for an object but it's completely possible for
us to hit the <0.5% chance of 50% failure 8 times in a row.

Since the max errors from the server is 100, set retries to the
same thing.

6 years agoMerge pull request #2039 from cgwalters/commit-cli-cleanup
OpenShift Merge Robot [Tue, 24 Mar 2020 01:22:22 +0000 (02:22 +0100)]
Merge pull request #2039 from cgwalters/commit-cli-cleanup

main/commit: Rework control flow to use --tree=X path

6 years agomain/commit: Rework control flow to use --tree=X path
Colin Walters [Sat, 21 Mar 2020 17:54:13 +0000 (17:54 +0000)]
main/commit: Rework control flow to use --tree=X path

Rework the simple cases of "commit ." and "commit argv[1]" to
generate the more general "--tree=X --tree=Y" path, so that we
only have one primary control flow here.

Prep for a future patch around loading SELinux policy from
the first argument.

6 years agoMerge pull request #2040 from cgwalters/itest-require-writable
OpenShift Merge Robot [Mon, 23 Mar 2020 19:01:04 +0000 (20:01 +0100)]
Merge pull request #2040 from cgwalters/itest-require-writable

tests/kola: Two test fixes

6 years agotests/kola: Two test fixes
Colin Walters [Sat, 21 Mar 2020 20:39:18 +0000 (20:39 +0000)]
tests/kola: Two test fixes

Now that we're actually running this in CI.

6 years agoMerge pull request #2037 from mwleeds/retry-on-partial-input
OpenShift Merge Robot [Fri, 20 Mar 2020 13:35:14 +0000 (14:35 +0100)]
Merge pull request #2037 from mwleeds/retry-on-partial-input

lib/fetcher-util: retry download on G_IO_ERROR_PARTIAL_INPUT

6 years agolib/fetcher-util: retry download on G_IO_ERROR_PARTIAL_INPUT
Matthew Leeds [Thu, 19 Mar 2020 22:28:08 +0000 (15:28 -0700)]
lib/fetcher-util: retry download on G_IO_ERROR_PARTIAL_INPUT

Add G_IO_ERROR_PARTIAL_INPUT to the list of error codes caused by
transient networking errors which lead us to retry the request. When
attempting to install the spotify flatpak you often get the error
message "Connection terminated unexpectedly" and the download of the deb
file fails. In this case, libsoup is setting G_IO_ERROR_PARTIAL_INPUT
and sometimes a subsequent download attempt is successful, so we should
treat it as transient.

Ideally we would behave as wget does in this case and retry the download
picking up where we left off in the file rather than starting over, but
that would require changes to libsoup I think.

Sadly this patch does not fix the flatpak installation of spotify in the
face of such errors, because flatpak doesn't use libostree to download
extra data, but presumably it's possible we could encounter such an
error pulling from an ostree repo, so the patch is still correct.

6 years agoMerge pull request #2036 from jlebon/pr/partial-parent
OpenShift Merge Robot [Thu, 19 Mar 2020 17:05:00 +0000 (18:05 +0100)]
Merge pull request #2036 from jlebon/pr/partial-parent

lib/pull: Don't leave commits pulled by depth as partial

6 years agoMerge pull request #2025 from cgwalters/use-kola-run-ext
OpenShift Merge Robot [Thu, 19 Mar 2020 16:32:23 +0000 (17:32 +0100)]
Merge pull request #2025 from cgwalters/use-kola-run-ext

tests: Rework tests/installed → tests/kola

6 years agotests: Rework tests/installed → tests/kola
Colin Walters [Wed, 11 Mar 2020 20:00:14 +0000 (20:00 +0000)]
tests: Rework tests/installed → tests/kola

Previously we made an effort to use the [Fedora Standard Test Interface](https://docs.fedoraproject.org/en-US/ci/standard-test-interface/).
This effort was not very successful; the primary thing that
it really died on is Ansible just didn't support rebooting
very well.  I think that's since gotten better, but even
then, Ansible wasn't the best thing for a test framework
for us anyways.

In the meantime Fedora CoreOS happened emphasizing Ignition
and not "post-hoc reconciliation" models like Ansible over
ssh.

And, [coreos-assembler](https://github.com/coreos/coreos-assembler) happened too.

Furthermore, we really need to test OSTree's interaction
with Ignition as we've invented several special things there.

Then most recently, I've been working on having
cosa/kola support running externally defined tests:
https://github.com/coreos/coreos-assembler/pull/1215

There's a lot of things to clean up after this but at least this
works for me:

```
$ cd /srv/fcos
$ cosa kola run -- --parallel 4 --output-dir tmp/kola -E ~/src/github/ostreedev/ostree/ 'ext.ostree.*'
```

NOTE: This *does not* drop ostree binaries into the target.  See:
https://github.com/coreos/coreos-assembler/pull/1252#issuecomment-600623315

This drops our dependency on Python in the installed tests, and
also fixes a few bugs that came up.

I disabled the `itest-bare-user-root.sh` one because it's
entangled with the shell script infrastructure for the unit tests.

6 years agolib/pull: Don't leave commits pulled by depth as partial
Jonathan Lebon [Thu, 19 Mar 2020 14:05:57 +0000 (10:05 -0400)]
lib/pull: Don't leave commits pulled by depth as partial

When pulling full parent commits via e.g. `--depth N`, we weren't
unmarking them as partial in the out path.

Closes: #2035
6 years agoMerge pull request #2034 from jlebon/pr/diff-docs
OpenShift Merge Robot [Thu, 19 Mar 2020 00:06:15 +0000 (01:06 +0100)]
Merge pull request #2034 from jlebon/pr/diff-docs

bin/diff: Clarify documentation around REV and DIR syntax

6 years agobin/diff: Clarify documentation around REV and DIR syntax
Jonathan Lebon [Wed, 18 Mar 2020 14:32:52 +0000 (10:32 -0400)]
bin/diff: Clarify documentation around REV and DIR syntax

Related: #2032

6 years agoMerge pull request #2033 from cgwalters/pin-error-handling
OpenShift Merge Robot [Wed, 18 Mar 2020 13:42:42 +0000 (14:42 +0100)]
Merge pull request #2033 from cgwalters/pin-error-handling

main/pin: Fix usage of GError

6 years agomain/pin: Fix usage of GError
Colin Walters [Wed, 18 Mar 2020 02:13:15 +0000 (02:13 +0000)]
main/pin: Fix usage of GError

This regressed in https://github.com/ostreedev/ostree/commit/2db79fb398fba2f9ab2e05c517ebccfe1834674b
I noticed this while finally getting the installed tests to run
in FCOS via kola and `ostree admin pin 0` is now aborting because
we were returning TRUE, but no error set.

I don't see a reason to try to continue on if we hit an error;
the original reporter was requesting support for multiple arguments,
but not "ignore invalid requests".

6 years agoMerge pull request #2030 from jlebon/pr/2020.3
OpenShift Merge Robot [Sat, 14 Mar 2020 15:17:21 +0000 (16:17 +0100)]
Merge pull request #2030 from jlebon/pr/2020.3

Release 2020.3

6 years agoPost-release version bump
Jonathan Lebon [Sat, 14 Mar 2020 01:56:14 +0000 (21:56 -0400)]
Post-release version bump

6 years agoRelease 2020.3
Jonathan Lebon [Sat, 14 Mar 2020 01:54:21 +0000 (21:54 -0400)]
Release 2020.3

Let's do another release to get the `sysroot.readonly` fixes into FCOS
and unpin ostree and rpm-ostree there.

6 years agoMerge pull request #2027 from cgwalters/pull-auto-mnt-namespace
OpenShift Merge Robot [Sat, 14 Mar 2020 01:52:43 +0000 (02:52 +0100)]
Merge pull request #2027 from cgwalters/pull-auto-mnt-namespace

main: Also automatically remount rw /sysroot for `ostree pull` etc.

6 years agomain: Also automatically remount rw /sysroot for `ostree pull` etc.
Colin Walters [Thu, 12 Mar 2020 21:10:29 +0000 (21:10 +0000)]
main: Also automatically remount rw /sysroot for `ostree pull` etc.

See https://github.com/coreos/fedora-coreos-tracker/issues/343
When we added the read-only sysroot support it broke using "raw"
`ostree pull` and `ostree refs --create` and all of the core repo
CLIs that just operate on a repo and not a sysroot.

Fixing this is a bit ugly as it "layer crosses" things even more.
Extract a helper function that works in both cases.

6 years agoMerge pull request #2029 from jlebon/pr/upgrade-tests
OpenShift Merge Robot [Fri, 13 Mar 2020 20:53:04 +0000 (21:53 +0100)]
Merge pull request #2029 from jlebon/pr/upgrade-tests

ci: use `fcosKola` for running kola tests

6 years agoci: use `fcosKola` for running kola tests
Jonathan Lebon [Fri, 13 Mar 2020 18:35:53 +0000 (14:35 -0400)]
ci: use `fcosKola` for running kola tests

We were using `--no-test-exit-error` for upgrade tests but weren't
actually checking for test failures after.

Instead of running kola directly, just use the `fcosKola` custom step
which automatically takes care of e.g. running tests in parallel and
archiving results.

6 years agoMerge pull request #2028 from cgwalters/ci-test-upgrades
OpenShift Merge Robot [Fri, 13 Mar 2020 18:18:40 +0000 (19:18 +0100)]
Merge pull request #2028 from cgwalters/ci-test-upgrades

ci: Test kola --upgrades

6 years agoci: Test kola --upgrades
Colin Walters [Fri, 13 Mar 2020 17:29:58 +0000 (17:29 +0000)]
ci: Test kola --upgrades

This one is very relevant for ostree.

6 years agoMerge pull request #2018 from jlebon/pr/migrate-to-coreos-ci
OpenShift Merge Robot [Wed, 4 Mar 2020 22:32:56 +0000 (17:32 -0500)]
Merge pull request #2018 from jlebon/pr/migrate-to-coreos-ci

ci: migrate to new coreos-ci project

6 years agoci: migrate to new coreos-ci project
Jonathan Lebon [Mon, 2 Mar 2020 19:22:14 +0000 (14:22 -0500)]
ci: migrate to new coreos-ci project

Use the new custom steps. I think we could simplify things further by
using `fcosBuild` but let's start with this for now.

6 years agoMerge pull request #2015 from cgwalters/release
OpenShift Merge Robot [Fri, 21 Feb 2020 15:16:50 +0000 (10:16 -0500)]
Merge pull request #2015 from cgwalters/release

Release 2020.2

6 years agoPost-release version bump
Colin Walters [Fri, 21 Feb 2020 14:48:00 +0000 (14:48 +0000)]
Post-release version bump

6 years agoRelease 2020.2
Colin Walters [Fri, 21 Feb 2020 14:39:14 +0000 (14:39 +0000)]
Release 2020.2

"Brown paper bag" release that actually sets the
`is_release_build=yes` flag and also fixes the
`Since:` on a few new functions.

6 years agoMerge pull request #2014 from ostreedev/fixup-since-versions
OpenShift Merge Robot [Thu, 20 Feb 2020 23:27:28 +0000 (18:27 -0500)]
Merge pull request #2014 from ostreedev/fixup-since-versions

lib: Fix Since versions for 2020.1

6 years agolib: Fix Since versions for 2020.1
Dan Nicholson [Thu, 20 Feb 2020 22:44:51 +0000 (15:44 -0700)]
lib: Fix Since versions for 2020.1

These had been added assuming 2019.7 would be the next version, but now
it's 2020 and there's been a release. In the case of
`OstreeCommitSizesEntry`, I'd forgotten to move it forward from 2019.5
to 2019.7 in the time between when I started working on the feature and
it landed.

6 years agoMerge pull request #2013 from cgwalters/prepareroot-comment
OpenShift Merge Robot [Thu, 20 Feb 2020 17:30:05 +0000 (18:30 +0100)]
Merge pull request #2013 from cgwalters/prepareroot-comment

prepare-root: Add a comment about the role of this service

6 years agoPost-release version bump
Colin Walters [Thu, 20 Feb 2020 16:37:07 +0000 (16:37 +0000)]
Post-release version bump

6 years agoRelease 2020.1
Colin Walters [Thu, 20 Feb 2020 16:16:19 +0000 (16:16 +0000)]
Release 2020.1

New year, new release!

6 years agoMerge pull request #1984 from jlebon/pr/supp-groups
OpenShift Merge Robot [Thu, 20 Feb 2020 02:07:41 +0000 (03:07 +0100)]
Merge pull request #1984 from jlebon/pr/supp-groups

lib/repo: Create repo directories as 0775

6 years agoprepare-root: Add a comment about the role of this service
Colin Walters [Thu, 20 Feb 2020 00:33:01 +0000 (00:33 +0000)]
prepare-root: Add a comment about the role of this service

Came up on an IRC question, docs for this are scattered around.

6 years agoMerge pull request #2012 from clime/patch-2
OpenShift Merge Robot [Wed, 19 Feb 2020 19:32:23 +0000 (20:32 +0100)]
Merge pull request #2012 from clime/patch-2

Update ostree-pull.xml with info about pulled refs location and access

6 years agoUpdate ostree-pull.xml with info about pulled refs location and access
clime [Tue, 18 Feb 2020 20:46:22 +0000 (21:46 +0100)]
Update ostree-pull.xml with info about pulled refs location and access

6 years agolib/repo: Create repo directories as 0775
Jonathan Lebon [Thu, 12 Dec 2019 21:40:33 +0000 (16:40 -0500)]
lib/repo: Create repo directories as 0775

For repo structure directories like `objects`, `refs`, etc... we should
be more permissive and let the system's `umask` narrow down the
permission bits as wanted.

This came up in a context where we want to be able to have read/write
access on an OSTree repo on NFS from two separate OpenShift apps by
using supplemental groups[1] so we don't require SCCs for running as the
same UID (supplemental groups are part of the default restricted SCC).

[1] https://docs.openshift.com/container-platform/3.11/install_config/persistent_storage/persistent_storage_nfs.html#nfs-supplemental-groups

6 years agoMerge pull request #2009 from cgwalters/testsuite
OpenShift Merge Robot [Fri, 14 Feb 2020 21:56:25 +0000 (22:56 +0100)]
Merge pull request #2009 from cgwalters/testsuite

deploy: Avoid trying to change immutable state unnecessarily